<?php

namespace app\common\model\mall\shop;

use think\Model;

class Extra extends Model
{
    // 表名
    protected $name = 'mall_shop_extra';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    
    // 追加属性
    protected $append = [
        'businessLicenceType_text',
        'legalCertificateType_text',
        'taxpayerType_text'
    ];
    

    
    public function getBusinesslicencetypeList()
    {
        return ['1' => __('Businesslicencetype 1'),'2' => __('Businesslicencetype 2'),'3' => __('Businesslicencetype 3')];
    }     

    public function getLegalcertificatetypeList()
    {
        return ['1' => __('Legalcertificatetype 1'),'2' => __('Legalcertificatetype 2'),'3' => __('Legalcertificatetype 3'),'4' => __('Legalcertificatetype 4')];
    }     

    public function getTaxpayertypeList()
    {
        return ['1' => __('Taxpayertype 1'),'2' => __('Taxpayertype 2'),'3' => __('Taxpayertype 3')];
    }     


    public function getBusinesslicencetypeTextAttr($value, $data)
    {        
        $value = $value ? $value : (isset($data['businessLicenceType']) ? $data['businessLicenceType'] : '');
        $list = $this->getBusinesslicencetypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getLegalcertificatetypeTextAttr($value, $data)
    {        
        $value = $value ? $value : (isset($data['legalCertificateType']) ? $data['legalCertificateType'] : '');
        $list = $this->getLegalcertificatetypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getTaxpayertypeTextAttr($value, $data)
    {        
        $value = $value ? $value : (isset($data['taxpayerType']) ? $data['taxpayerType'] : '');
        $list = $this->getTaxpayertypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
